#ifndef COMMONPAGE_H
#define COMMONPAGE_H

#include <QWidget>
#include"musiclist.h"
#include<QMediaPlaylist>
namespace Ui {
class CommonPage;
}

enum PageType
{
    LIKE_PAGE, //我喜欢页面
    LOCAL_PAGE,//本地播放页面
    RECENT_PAGE//最近播放页面
};
class CommonPage : public QWidget
{
    Q_OBJECT

public:
    explicit CommonPage(QWidget *parent = nullptr);
    ~CommonPage();

    void setCommonPageUI(const QString&text,const QString&imagePath);
    void setMusicListType(PageType pageType);
    void addMusicToMusicPage(MusicList& musicList);
    void refresh(MusicList& musicList);
    void addMusicToPlayerlist(MusicList& musicList,QMediaPlaylist* playerlist);
    QString getMusicidOfIndex(int index);
    void setMusicImage(QPixmap pixmap);
signals:
    void updateLikeMusic(bool isLike,const QString& musicId);
    void playAll(PageType);
    void playMusicByIndex(CommonPage*,int);



private:
    Ui::CommonPage *ui;
    PageType pageType;//保存该页面的类别说明
    QVector<QString> musicOfPage;//保存对应页面下的歌曲id
};

#endif // COMMONPAGE_H
